﻿using Newtonsoft.Json;
using RestSharp;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp4.Model
{
    public class DbHelper
    {
        private SqlSugarClient _sqlsugarClient;
        public SqlSugarClient db
        {
            /*写入Mysql安装Sqlsugar,Json.net,Mysql.Data三个插件*/
            get
            {
                if (_sqlsugarClient == null)
                {
                    var conn = "Database=easycms;Data Source=.;User Id=root;Password=root;pooling=false;CharSet=utf8;port=3306";
                    var db = new SqlSugarClient(
                    new ConnectionConfig()
                    {
                        ConnectionString = conn,
                        DbType = DbType.MySql,
                        IsAutoCloseConnection = true
                    });
                    _sqlsugarClient = db;
                }
                return _sqlsugarClient;
            }
        }

        public async Task Add(sys_area info)
        {

            await Task.Delay(0);
            // await db.Insertable<sys_area>(info).ExecuteCommandAsync();
        }
      
    }

}
